<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>${entity.name}</title>
		
        <c:set var="messageboard"><spring:theme code="messageboard"/></c:set>
        <link rel="stylesheet" href="<c:url value="${messageboard}"/>" type="text/css" />
        <c:set var="profile"><spring:theme code="profile"/></c:set>
        <link rel="stylesheet" href="<c:url value="${profile}"/>" type="text/css" />
        <c:set var="projectprofile"><spring:theme code="projectprofile"/></c:set>
        <link rel="stylesheet" href="<c:url value="${projectprofile}"/>" type="text/css" />
		
	</head>

	<body>

		<c:url scope="page" value="/project/editprofile.html" var="editProjectURL">
			<c:param name="id" value="${entity.id}"/>
		</c:url>
		<c:url scope="page" value="/noticeboard/edit.html" var="editNoticeBoardURL">
			<c:param name="id" value="${entity.id}"/>
		</c:url>
		<c:url scope="page" value="/project/inviteto.html" var="inviteToProjectURL">
			<c:param name="id" value="${entity.id}"/>
		</c:url>
		
		<c:choose>
			<c:when test="${entity.owner.organisation}">
				<c:url scope="page" value="/organisation/profile.html" var="projectOwnerProfileURL">
					<c:param name="id" value="${entity.owner.id}"/>
				</c:url>		
			</c:when>
			<c:when test="${entity.owner.user}">
				<c:url scope="page" value="/user/profile.html" var="projectOwnerProfileURL">
					<c:param name="id" value="${entity.owner.id}"/>
				</c:url>
			</c:when>
			<c:otherwise>
				<c:url scope="page" value="/group/profile.html" var="projectOwnerProfileURL">
					<c:param name="id" value="${entity.owner.id}"/>
				</c:url>
			</c:otherwise>
		</c:choose>
		

		<!-- BEGIN LEFT COLUMN -->
		<div id="leftcolumn">

			<!-- BEGIN PROJECT PHOTO -->
			<div id="profilePhoto">
				<c:url scope="page" value="/getImage.do" var="entityImg">
					<c:param name="imgsrc" value="${entity.imgSrc}"/>
				</c:url>
				<img src="${entityImg}" width="130" alt="${entity.name}" class="profilePhoto"/>
			</div>
			<!-- END PROJECT PHOTO -->

			<!-- BEGIN LEFT NAV OPTIONS -->
			<div id="leftnavOptions">
			
				<handsunited:relationship entity="${loggedInUser}" member="${entity}">
					<handsunited:role role="admin">				
						<div id="editProfile" class="leftnavLink">
							<a href="${editProjectURL}" class="leftnavButton">&raquo; Edit ${entity.name}</a>
						</div> <!-- #editProfile -->
						<div id="editNoticeBoard" class="leftnavLink">
							<a href="editNoticeBoardURL" class="leftnavButton">&raquo; Edit notice board</a>
						</div>
					</handsunited:role>
				</handsunited:relationship>

				<div id="inviteTo" class="leftnavLink">
					<a href="${inviteToProjectURL}" class="leftnavButton">&raquo; Invite friends to join ${entity.name}</a>
				</div> <!-- #editProfile -->

			</div> <!-- #leftnavOptions -->

			<!-- END LEFT NAV OPTIONS -->
		</div>
		<!-- END LEFT COLUMN -->


		<!-- BEGIN CENTRE COLUMN -->
		<div id="centercolumn">

			<div id="projectName">
				<h1 id="projectName" class="entityName">${entity.name}</h1>
			</div>

			<div id="projectSummary" class="summary">
				${entity.summary}
			</div>

			<!-- BEGIN PROJECT DESCRIPTION -->
			<div id="projectDescription" class="description">
				${entity.description}
			</div> <!-- #projectDescription -->
			<!-- END PROJECT DESCRIPTION -->

			<!-- BEGIN PROJECT DETAILS -->
			<div id="projectDetails">

				<h2 id="projectDetailsTitle" class="sectionHeader">Project details:</h2>

				<table id="projectDetails" class="details">

					<colgroup>
						<col id="title" />
						<col id="content" />
					</colgroup>

					<tr class="row1">
						<td>Organised by:</td>
						<td><a href="${projectOwnerProfileURL}">${entity.owner.name}</a></td>
					</tr>
					<tr class="row2">
						<td>Dates:</td>
						<td>
							<joda:format value="${entity.startDate.date}" style="S-" />
							- 
							<joda:format value="${entity.endDate.date}" style="S-" />
						</td>
					</tr>
					<tr class="row1">
						<td>Operating hours:</td>
						<td>
							<jsp:include page="/WEB-INF/jsp/tiles/availability.jsp"/>
						</td>
					</tr>
					<tr class="row2">
						<td>Work from:</td>
						<td>
							<c:if test="${entity.workFromHome}">
								<a href="#">Home</a>	
							</c:if>
							
							<c:if test="${entity.workFromHome && entity.workOnSite}">
							and
							</c:if>
							
							<c:if test="${entity.workOnSite}">
								<a href="#">On site</a>	
							</c:if>
						</td>
					</tr>
					<tr class="row1">
						<td>Location:</td>
						<td>
							${entity.location.number} ${entity.location.street}<br/>
							${entity.location.suburb}<br/>
							${entity.location.city}<br/>
							${entity.location.state } ${entity.location.postcode}
						</td>
					</tr>
					<tr class="row2">
						<td>Project categories:</td>
						<td>
							<c:forEach items="${entity.serviceCategories}" var="serviceCategory">
								<a href="#">${serviceCategory.name}</a> <br />
							</c:forEach>
						</td>
					</tr>
					<tr class="row1">
						<td>Recommended for:</td>
						<td>
							<c:if test="${entity.recommendedForGroups}">
								<a href="#">Groups</a> <br />
							</c:if>													
							<c:if test="${entity.recommendedForYouth}">
								<a href="#">Youth</a> <br />	
							</c:if>
							<c:if test="${entity.recommendedForKids}">
								<a href="#">Kids</a> <br />
							</c:if>
							<c:if test="${entity.recommendedForOldies}">
								<a href="#">Oldies</a> <br />	
							</c:if>
							<c:if test="${entity.recommendedForLadies}">
								<a href="#">Ladies</a> <br />
							</c:if>
						</td>
					</tr>
					<tr class="row2">
						<td>#Volunteers required:</td>
						<td>${entity.numberRequired}</td>
					</tr>
					<tr class="row1">
						<td>Commitment:</td>
						<td>${entity.hourlyCommitment} hours a ${entity.commitmentType}</td>
					</tr>
					<tr class="row2">
						<td>Required languages:</td>
						<td>
							<c:forEach items="${entity.languages}" var="language">
								<a href="#">${language.name}</a><br />
							</c:forEach>
						</td>
					</tr>
					<tr class="row1">
						<td>Required skills:</td>
						<td>
							<c:forEach items="${entity.skills}" var="skill">
								<a href="#">${skill.name}</a><br />
							</c:forEach>
						</td>
					</tr>
					<tr class="row2">
						<td>Website:</td>
						<td><a href="${entity.contactInfo.website}">${entity.contactInfo.website}</a></td>
					</tr>
				</table>
			</div> <!-- #projectDetails -->
			<!-- END PROJECT DETAILS -->

			<!-- BEGIN CONTACT INFO -->
			<div id="projectContactInfo" class="contactInfo">

				<h2 id="projectContactInfoTitle" class="sectionHeader">Contact info:</h2>

				<table id="projectContactInfoTable">
					<colgroup>
						<col id="title" />
						<col id="content" />
					</colgroup>

					<tr class="row1">
						<td>
							Name:
						</td>
						<td>
							${entity.contactInfo.name}
						</td>
					</tr>

					<tr class="row2">
						<td>Address:</td>
						<td>
							${entity.contactInfo.address.number} ${entity.contactInfo.address.street}<br/>
							${entity.contactInfo.address.suburb}<br/>
							${entity.contactInfo.address.city}<br/>
							${entity.contactInfo.address.state } ${entity.contactInfo.address.postcode}
						</td>
					</tr>

					<tr class="row1">
						<td>Phone numbers:</td>
						<td>
							W: ${entity.contactInfo.workPhone} <br />
							M: ${entity.contactInfo.mobilePhone}
						</td>
					</tr>

					<tr class="row2">
						<td>Fax:</td>
						<td>${entity.contactInfo.faxNumber}</td>
					</tr>

					<tr class="row1">
						<td>Email address:</td>
						<td>
							<a href="mailto:${entity.contactInfo.emailAddress}">${entity.contactInfo.emailAddress}</a>
						</td>
					</tr>

				</table>

			</div> <!-- #projectContactInfo -->
			<!-- END CONTACT INFO -->


			<!-- BEGIN MESSAGE BOARD -->
			<jsp:include page="/WEB-INF/jsp/tiles/messageBoard.jsp"/>
			<!-- END MESSAGE BOARD -->

		</div>
		<!-- END CENTRE COLUMN -->





<%--

		<table width="100%" border="0">
			<tr>
				<td colspan="5"></td>
			</tr>
			
			<tr>
				<!-- BEGIN LEFT COLUMN -->
				<td width="15%" valign="top"> 
					
					<!-- BEGIN PROJECT PHOTO -->
					<table width="100%" border="1" bgcolor="#C3D9FF">
						<tr>
							<td>
								<table width="100%" border="0">
									<tr>
										<td>
											<c:url scope="page" value="/getImage.do" var="entityImg">
												<c:param name="imgsrc" value="${entity.imgSrc}"/>
											</c:url>
											<img src="${entityImg}" width="160" alt="${entity.name}" border="0"/>
										</td>
									</tr>
									<tr>
										<td>${entity.name}</td>
									</tr>
								</table>
							</td>

						</tr>
					</table>
					<!-- END PROJECT PHOTO -->

					<!-- BEGIN SPACER TABLE -->
					<table width="100%" border="0">
						<tr>
							<td>&nbsp;</td>
						</tr>

					</table>
					<!-- END SPACER TABLE -->
					
					<!-- BEGIN PROJECTS -->
					<table width="100%" border="1">
						<tr>
							<td>
								<table width="100%" border="0">
									<tr>
										<td>

											<table width="100%" border="0">
												<tr>
													<td colspan="2" width="100%">Projects</td>
												</tr>

												<tr>
													<td width="10%">&nbsp;</td>
													<td width="90%">

														<c:url scope="page" value="/project/joinproject.html" var="joinProjectURL">
															<c:param name="id" value="${entity.id}"/>
														</c:url>
														<c:url scope="page" value="/project/leaveproject.html" var="leaveProjectURL">
															<c:param name="id" value="${entity.id}"/>
														</c:url>

								        				<handsunited:relationship entity="${loggedInUser}" member="${entity}">
								        					<handsunited:status status="Unknown">
								        						<c:choose>
								        							<c:when test="${entity.owner.owner != null and entity.owner.owner.id == loggedInUser.id}">
												        				<a href="${editProjectURL}">
												        					Edit Project
												        				</a>
								        							</c:when>
								        							<c:otherwise>
												        				<a href="${joinProjectURL}">
												        					Join project
												        				</a>
								        							</c:otherwise>
								        						</c:choose>
								        					</handsunited:status>
								        					<handsunited:status status="Active">
										        				<c:choose>
											        				<c:when test="${loggedInUser.id == entity.owner.id}">
												        				<a href="${editProjectURL}">
												        					Edit Project
												        				</a>
											        				</c:when>
																	<c:otherwise>
												        				<a href="${leaveProjectURL}">
												        					Leave project
												        				</a>
																	</c:otherwise>										        				
										        				</c:choose>
								        					</handsunited:status>
								        					<handsunited:status status="AwaitingAuthorisation">
								        						Awaiting Authorisation
								        					</handsunited:status>
								        					<handsunited:status status="ActionPending">
								        						Authorise | Reject
								        					</handsunited:status>
								        				</handsunited:relationship>
													</td>
												</tr>
												<tr>
													<td width="10%">&nbsp;</td>
													<td width="90%"><a href="editproject.html">Tell People About This Project</a></td>
												</tr>
												<tr>
													<td width="10%">&nbsp;</td>
													<td width="90%"><a href="projectsearch.html">Contact Project Owner</a></td>
												</tr>

											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
					<!-- END PROJECTS -->

					<!-- BEGIN SPACER TABLE -->
					<table width="100%" border="0">
						<tr>
							<td>&nbsp;</td>
						</tr>
					</table>
					<!-- END SPACER TABLE -->
				</td>
				<!-- END LEFT COLUMN -->

				<!-- BEGIN SPACER COLUMN -->

				<td width="1%">&nbsp;</td>
				<!-- END SPACER COLUMN -->



		<!-- BEGIN CENTRE COLUMN -->
		<div id="centercolumn">

			<!-- BEGIN MESSAGE BOARD -->
			<jsp:include page="/WEB-INF/jsp/tiles/messageBoard.jsp"/>
			<!-- END MESSAGE BOARD -->

		</div>
		<!-- END CENTRE COLUMN -->
--%>


		<!-- BEGIN RIGHT COLUMN -->
		<div id="rightcolumn">
				
			<!-- BEGIN FRIENDS SECTION -->
			<jsp:include page="/WEB-INF/jsp/tiles/user/network.jsp"/>
			<!-- END FRIENDS SECTION -->
			
			<!-- BEGIN PROJECTS SECTION -->
			<jsp:include page="/WEB-INF/jsp/tiles/project/network.jsp"/>
			<!-- END PROJECTS SECTION -->
			
		</div>
		<!-- END RIGHT COLUMN -->

	</body>
</html>
